//
//  HotCircleTableViewCell.m
//  DefendHealth
//
//  Created by 吾诺翰卓003 on 17/2/18.
//  Copyright © 2017年 iMacOne. All rights reserved.
//

#import "HotCircleTableViewCell.h"
#import "Header.h"
#import "HisDynamicViewController.h"
@interface HotCircleTableViewCell ()
{
    UIImageView *touxiangImg;
    UILabel *nameLab;
    UILabel *timeLab;
    UILabel *contentLab;
}
@end
@implementation HotCircleTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        UIView *hui = [UIView new];
        hui.frame = CGRectMake(0, 0,WindowWidth , 5);
        hui.backgroundColor = kLineColor;
        [self.contentView addSubview:hui];
        
        touxiangImg = [UIImageView new];
        touxiangImg.frame = CGRectMake(10, 12+5, 48, 48);
        touxiangImg.layer.cornerRadius = 25;
        touxiangImg.layer.masksToBounds = YES;
        touxiangImg.backgroundColor = [UIColor grayColor];
        [self.contentView addSubview:touxiangImg];
        
        UIButton *gerenzhuyebtn1 = [[UIButton alloc] initWithFrame:CGRectMake(10, 12+5, 50, 50)];
        
        [gerenzhuyebtn1 addTarget:self action:@selector(gerenzhuye) forControlEvents:UIControlEventTouchUpInside];
        
        [self.contentView addSubview:gerenzhuyebtn1];
        
        nameLab = [UILabel new];
        nameLab.frame = CGRectMake(kMaxX(touxiangImg.frame)+12, 24+5, WindowWidth, 14);
        nameLab.text = @"明日春娇   2分钟前";
        nameLab.font = FONT(14);
        nameLab.textColor = UIColorFromRGB(0x333333);
        nameLab.textAlignment = 0;
        [self.contentView addSubview:nameLab];
        
        contentLab = [UILabel new];
        contentLab.frame = CGRectMake(kMaxX(touxiangImg.frame)+12, kMaxY(nameLab.frame)+12, WindowWidth, 10);
        contentLab.text = @"浙江杭州 21岁 女";
        contentLab.font = FONT(10);
        contentLab.textColor = UIColorFromRGB(0x333333);
        contentLab.textAlignment = 0;
        [self.contentView addSubview:contentLab];
        
        UIButton *btn1 = [[UIButton alloc] initWithFrame:CGRectMake(WindowWidth-10-80, 24, 80, 30)];
        [btn1 setTitle:@"关注" forState:UIControlStateNormal];
        [btn1 addTarget:self action:@selector(guanzhu) forControlEvents:UIControlEventTouchUpInside];
        btn1.titleLabel.font = FONT(13);
        btn1.backgroundColor = [UIColor grayColor];
        [btn1 setTitleColor:[UIColor whiteColor] forState:0];
        
        [self.contentView addSubview:btn1];
        
        for (int i = 0 ; i<2; i++) {
            UIImageView *img = [UIImageView new];
            img.frame = CGRectMake(kMaxX(touxiangImg.frame)+12+i*12+(WindowWidth-24-12-(kMaxX(touxiangImg.frame)+12))/2*i, kMaxY(contentLab.frame)+12, (WindowWidth-24-12-(kMaxX(touxiangImg.frame)+12))/2, 81.5);
            [self.contentView addSubview:img];
            img.backgroundColor = [UIColor grayColor];
        }
        
        UILabel *lab1 = [UILabel new];
        lab1.frame = CGRectMake(kMaxX(touxiangImg.frame)+12, kMaxY(contentLab.frame)+81.5+20, WindowWidth, 12);
        lab1.text = @"#开车啦#“健身养生“第一步 凌波微步";
        lab1.font = FONT(12);
        lab1.textColor = UIColorFromRGB(0x333333);
        lab1.textAlignment = 0;
        [self.contentView addSubview:lab1];
        
        UIView *hui2 = [UIView new];
        hui2.frame = CGRectMake(kMaxX(touxiangImg.frame)+12, kMaxY(lab1.frame)+11,WindowWidth , 0.5);
        hui2.backgroundColor = kLineColor;
        [self.contentView addSubview:hui2];
        
        UILabel *lab2 = [UILabel new];
        lab2.frame = CGRectMake(kMaxX(touxiangImg.frame)+12, kMaxY(hui2.frame)+10, 118, 12);
        lab2.text = @"加油 115";
        lab2.font = FONT(12);
        lab2.textColor = UIColorFromRGB(0x000000);
        lab2.textAlignment = 0;
        [self.contentView addSubview:lab2];
        
        UIImageView *img1 = [UIImageView new];
        img1.frame = CGRectMake(WindowWidth-10-20, kMaxY(hui2.frame)+10, 20, 20);
        img1.image = [UIImage imageNamed:@"comment-1"];
        [self.contentView addSubview:img1];
        
        UIImageView *img2 = [UIImageView new];
        img2.frame = CGRectMake(WindowWidth-10-20-10-20, kMaxY(hui2.frame)+10, 20, 20);
        img2.image = [UIImage imageNamed:@"praise-1"];
        [self.contentView addSubview:img2];
        
        UIImageView *img3 = [UIImageView new];
        img3.frame = CGRectMake(WindowWidth-10-20-10-20-10-20, kMaxY(hui2.frame)+10, 20, 20);
        img3.image = [UIImage imageNamed:@"upload@2x(1)"];
        [self.contentView addSubview:img3];
        NSLog(@"--f %f",kMaxY(img3.frame));
        
    }
    return self;
}
-(void)guanzhu{

}
- (UIViewController *)viewController{
    for (UIView *next = [self superview]; next; next = next.superview) {
        UIResponder *nextResponder = [next nextResponder];
        if ([nextResponder isKindOfClass:[UIViewController class]]) {
            return (UIViewController *)nextResponder;
        }
    }
    return nil;
}
-(void)gerenzhuye{
    HisDynamicViewController *stVC = [HisDynamicViewController new];
    stVC.hidesBottomBarWhenPushed = YES;
    [[self viewController].navigationController pushViewController:stVC animated:YES];
}
@end
